/**
 * 上传图片
 */
ZHT.upload = function(opts){	
  var _opts = {};
  _opts = $.extend(_opts,{duplicate:true,auto: true,compress:false,swf: ZHT.conf.STATIC +'/plugins/webuploader/Uploader.swf',server:ZHT.U('home/base/uploadPic')},opts);
  var uploader = WebUploader.create(_opts);
  uploader.on('uploadSuccess', function( file,response ) {
		// console.log(response);
		var json = ZHT.toJson(response._raw);
		// var json = response;
		if(_opts.callback)_opts.callback(json,file);
  });
  uploader.on('uploadError', function( file ) {
    if(_opts.uploadError)_opts.uploadError();
  });
  uploader.on('uploadProgress', function( file, percentage ) {
    percentage = percentage.toFixed(2)*100;
    if(_opts.progress)_opts.progress(percentage);
  });
    return uploader;
}
